<?php

/**
 * auditoria form base class.
 *
 * @method auditoria getObject() Returns the current form's model object
 *
 * @package    plagas
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseauditoriaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'tabla'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('tabla'), 'add_empty' => false)),
      'ids'        => new sfWidgetFormInputText(),
      'anterior'   => new sfWidgetFormTextarea(),
      'nuevo'      => new sfWidgetFormTextarea(),
      'accion'     => new sfWidgetFormInputText(),
      'usuario_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('user'), 'add_empty' => false)),
      'fechaYHora' => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'tabla'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('tabla'))),
      'ids'        => new sfValidatorInteger(),
      'anterior'   => new sfValidatorString(array('max_length' => 300, 'required' => false)),
      'nuevo'      => new sfValidatorString(array('max_length' => 300, 'required' => false)),
      'accion'     => new sfValidatorString(array('max_length' => 12)),
      'usuario_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('user'))),
      'fechaYHora' => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('auditoria[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'auditoria';
  }

}
